from pptx import Presentation
from pptx.util import Inches

# 实例化ppt对象
ppt = Presentation()
# 空白布局
layout = ppt.slide_layouts[6]
# 添加幻灯片
slide = ppt.slides.add_slide(layout)
# 定义图片添加的位置
left = Inches(0)
top = Inches(0)
# 定义插入图片的大小
width = Inches(2)
height = Inches(2)
img_path = 'header.jpeg'
# 将图片插入幻灯片
pic = slide.shapes.add_picture(img_path, left, top, width, height)
ppt.save('add_image.pptx')